/*Write a function c a t () that takes two Cstyle
string arguments and returns a string that is
the concatenation of the arguments. Use n e w to find store for the result.*/
#include <iostream>
using namespace std;

char* cat_zhu(const char* p1, const char* p2)
{
    int length = strlen(p1) + strlen(p2);
    char* pret = new char[length + 1];
    char* p = pret;
    while( *p1 != '\0') *p++ = *p1++;
    while( *p2 != '\0') *p++ = *p2++;
    pret[length] = '\0';
    return pret;
}

    
int main()
{
    char a[] = "ABCDEFG";
    char b[] = "higklm";
    char* ret = cat_zhu(a,b);
    cout << ret << endl;
    delete[] ret;
}
